import React, {Component} from 'react'

import {Checkbox, Button} from 'antd'
import { WeaLocaleProvider } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

export default  class CommentBar extends Component{

    constructor(props) {
        super(props);
        this.state={
            disabled:false
        }
    }


    onSubComment = () => {
        const {submitComment} = this.props;
        this.setState({disabled:true});
        submitComment();
    }

    render (){
        const {setPrivate,  cancelComment,className = "", checked, ...rest} = this.props
        return (
            <div className={"wea-weibo-comment-bar " + className} {...rest}>
                <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@tgqyeb`} onClick={cancelComment} type="ghost" className="wea-wcb-cancel">{getLabel(31129,"取消")}</Button>
                <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@h8vsw8`}  disabled={this.state.disabled} onClick={this.onSubComment} type="primary" className="wea-wcb-submit">{getLabel(675,"评论")}</Button>
                <Checkbox ecId={`${this && this.props && this.props.ecId || ''}_Checkbox@e1w5jj`} checked={checked}  onChange={setPrivate} className="wea-wcb-private">{getLabel(83281,"私密")}</Checkbox>
            </div>
        )
    }

}